package com.shardingsphere.example.mapper;

import com.shardingsphere.example.annotation.ShardingTable;
import com.shardingsphere.example.entity.User;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

import java.util.List;



@Repository
@ShardingTable(logicTable = "user", shardingKey = "userId")
public interface UserMapper {
    /**
     * 插入用户
     */
    int insert(User user);

    /**
     * 根据userId查询用户
     */
    User selectByUserId(@Param("userId") String userId);

    /**
     * 根据年龄查询用户
     */
    List<User> selectByAge(@Param("age") Integer age);

    /**
     * 查询所有用户
     */
    List<User> selectAll();
}
